#ifndef CONTROLLABLEOBJECT_H
#define CONTROLLABLEOBJECT_H

#include "drawableObject.h"
#define NUM_INPUT_KEYS 18

class ControllableObject : public DrawableObject
{
public:
	ControllableObject(void);
	ControllableObject(std::vector<sf::Key::Code> &inputVector);
	//setters and getters
	void InputKeys(std::vector<sf::Key::Code> &inputVector);
	std::vector<sf::Key::Code> &InputKeys(){return inputVector;}
	void Input(const sf::Input &input);
	void Input(const sf::Input &input, void *extraData);
	virtual void draw(sf::RenderWindow &window) = 0;
protected:
	std::vector<sf::Key::Code> inputVector;
	//there are 14 different keys on the PS one game controller
	//That will be used for this game.
	sf::Key::Code keys[NUM_INPUT_KEYS];
	sf::Key::Code defaultKeys[NUM_INPUT_KEYS];
	//stores the state of a give button that is pressed
	bool keysPressed[NUM_INPUT_KEYS];

	//***************************************************//
	//in order to pass needed data to the input function 
	//use the following example to help retrieve the data
	//***************************************************//
	//EXAMPLE:
	//void input0(void* objectsData)
	//{
	//	// Cast the parameter back to its real type
	//	MyClass* Object = static_cast<MyClass*>(objectsData);
	//}
	///////////////////////////////////////////////////////
	//there are 2 states for each key either down or up, thus
	//we will have the number of keys times 2 to get the correct
	//number of functions to control their states.
	void (*inputFunctions[NUM_INPUT_KEYS * 2])(void *object, void *extraData);
	void Input(const sf::Input &input, void *object, void *extraData);
private:
	//initualizes ControllableObjects default keys and default functions.
	void init();
	void initKeys();
};

//Does nothing but allows for the func member variable
//to point at something if the input for that function
//is not need for the object.
void voidFunction(void *object, void *extraData);

#endif //CONTROLLABLEOBJECT_H